package com.example.liwushuo.adapter;

import java.util.List;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.example.liwushuo.BaseApp;
import com.example.liwushuo.R;
import com.example.liwushuo.bean.homegridview.glzt.Collection;

public class AllZTAdapter extends AppAdapter<Collection> {

	public AllZTAdapter(Context context, List<Collection> list) {
		super(context, list);
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		ViewHolder holder;
		if (convertView == null) {
			convertView = inflater.inflate(R.layout.item_allzt, null);
			holder = new ViewHolder(convertView);
			convertView.setTag(holder);
		} else {
			holder = (ViewHolder) convertView.getTag();
		}
		holder.subtitle.setText(list.get(position).getSubtitle());
		holder.title.setText(list.get(position).getTitle());
		BaseApp.getBitmapUtils().display(holder.img,
				list.get(position).getCover_image_url());
		return convertView;
	}

	private static class ViewHolder {

		ImageView img;
		TextView subtitle;
		TextView title;

		public ViewHolder(View view) {
			img = (ImageView) view.findViewById(R.id.allzt_img);
			subtitle = (TextView) view.findViewById(R.id.allzt_subtitle);
			title = (TextView) view.findViewById(R.id.allzt_title);

		}
	}

}
